//////#include<iostream>
//////#include<algorithm>
//////const int N = 1e6 + 10;
//////int a[N];
//////using namespace std;
//////int main()
//////{
//////	int t;cin >> t;
//////	while (t--)
//////	{
//////		int c, m, x;cin >> c >> m >> x;
//////		if (c == 0 || m == 0)
//////		{
//////			cout << 0 << endl;
//////			continue;
//////		}
//////		int count = 0,sum = 0;
//////		while ((c > 0 || m > 0) && c + m + x >= 3)
//////		{
//////			if (c > 0)
//////			{
//////				c -= 1;
//////				sum += 1;
//////			}	
//////			if (m > 0)
//////			{
//////				m -= 1;
//////				sum += 1;
//////			}
//////			if (x > 0)
//////			{
//////				x -= 1;
//////				sum += 1;
//////			}
//////		}
//////	}
//////	return 0;
//////}
////#include<iostream>
////const int N = 1e6 + 10;
////using namespace std;
////int a[N];
////int dfs(int c, int m, int x)
////{
////	if (c == 0 || m == 0) return 0;
////
////}
////int main()
////{
////	int t;cin >> t;
////	while (t--)
////	{
////		int c, m, x;cin >> c >> m >> x;
////		cout << dfs(c, m, x) << endl;
////	}
////	return 0;
////}
////
//#include<iostream>
//const int N = 1e6 + 10;
//int a[N];
//using namespace std;
//int main()
//{
//	int t;cin >> t;
//	while (t--)
//	{
//		int c, m, x;cin >> c >> m >> x;
//		if (c == 0 && m == 0 && c + m + x < 3)
//		{
//			cout << 0 << endl;
//			continue;
//		}
//		int sum = 0;
//		int t1 = max(c, m);
//		int t2 = min(c, m);
//		while (c > 0 && m > 0 && x > 0)
//		{
//			int t1 = max(c, m);
//			if (x >= 2 && t1 > 0)
//			{
//				x -= 2;
//				t1 -= 1;
//				sum += 1;
//			}
//			else
//			{
//				x -= 1;
//				t1 -= 1;
//				t2 -= 1;
//				sum += 1;
//			}
//		}
//
//	}
//	return 0;
//}
//

#include<iostream>
#include<unordered_map>
using namespace std;
int main()
{
	unordered_map<int, int> mp;
	int t;cin >> t;
	while (t--)
	{
		int c, m, x;cin >> c >> m >> x;
		mp[1] = c;mp[2] = m;mp[3] = x;
		int count = 0;
		if (mp[1] == 0 || mp[2] == 0)
		{
			cout << 0 << endl;
			continue;
		}
		while (mp[1] > 0 && mp[2] > 0 && mp[3] > 0)
		{
				mp[3] -= 1;
				mp[2] -= 1;
				mp[1] -= 1;
				count += 1;
		}
		if(mp[2] !=0 && mp[1] !=0 && mp[3] == 0)
		count += (mp[1] + mp[2]) / 3;
		cout << count << endl;
	}
	return 0;
}